package com.tsu.mall.admin.mapper;

import com.tsu.mall.admin.entity.Attendant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tttttt
 * @since 2023-03-17
 */
public interface AttendantMapper extends BaseMapper<Attendant> {

    List<Attendant> doSelectListPage(String keyword);

    @Select("select * from attendant where username=#{username} ;")
    List<Attendant> check(String username);

    @Update("update attendant set superadmin='是' where username=#{transAttendantName}")
    void updateByName(String transAttendantName);

    @Update("update attendant set superadmin='否' where id=#{superId}")
    void updateByCurrentSuperId(Integer superId);


    @Select("select username from attendant where superadmin='是' ;")
    String selectBySuperAdmin();

    @Update("update attendant set  password=#{newPassword} where username=#{username}")
    void doUpdatePassword(String newPassword,String username);
}
